home *** CD-ROM | disk | FTP | other *** search
/ Swimwear Illustrated / Swimwear Illustrated.iso / mac / MAIN8 / MAIN8.DIR / 00017_Script_17 < prev    next >
Text File  |  1996-02-22  |  3KB  |  56 lines

  1. --
  2. on initButtons -- so they are mouse down responsive
  3. global FirstBtnCast, FirstBtnTrack, LastBtnTrack
  4.  -- ButtonCast: 1st "invisible" target, 2nd: generic rollover hilite
  5. -- remaining ones "pushed down" with b.g. copied on face 1 for each button
  6. ---------------------------------------------------------------------
  7. --<<<< Change the 3 values below to match your design >>>>--
  8. put 1 into FirstBtnCast --*** change this when shuffling cast ***
  9. put 3 into FirstBtnTrack --*** change this to match score ***
  10. put 4 into NumberofBtns --*** chance this to match your setup ***
  11. ---------------------------------------------------------------------
  12. put FirstBtnTrack + NumberofBtns- 1 into LastBtnTrack
  13. repeat with i = FirstBtnTrack to LastBtnTrack
  14. set the immediate of sprite i to true -- for mouse Down score script activation
  15. end repeat
  16.  
  17. on ScanButtons
  18. global lastHiBtn,FirstBtnCast,FirstBtnTrack, LastBtnTrack
  19. put 0 into overBtn
  20. repeat with i =  FirstBtnTrack to LastBtnTrack -- test for mouse over buttons
  21. if rollOver(i) then
  22.   put i into overBtn -- found one
  23.   exit repeat -- save time, scan no farther
  24.   end if
  25. end repeat
  26. if overBtn  <> lastHiBtn and lastHiBtn <> 0 then -- previously hilited one
  27. -- make previous hi btn generic "invisible" target rectangle
  28.   set the castNum of sprite lastHiBtn to FirstBtnCast 
  29.   set the puppet of sprite lastHiBtn to false -- return score control, for simplicity
  30. end if
  31. put overBtn into lastHiBtn -- to be restored later
  32. if overBtn > 0 then -- over any btn
  33.   set the puppet of sprite overBtn to true -- changable
  34.   set the castNum of sprite overBtn to FirstBtnCast + i-2 -- generic roll over hilite image
  35.   updateStage
  36. end if
  37.  
  38. on HitMe Destination -- mouse is down on an (immediate) button
  39. global FirstBtnCast, FirstBtnTrack
  40. put clickon() into target
  41. set the puppet of sprite target to true -- changable (redundent if hilited, but harmless)
  42. put FirstBtnCast + 2 + ( target - FirstBtnTrack) into SquishedBtnCast
  43.   set the castNum of sprite target to SquishedBtnCast -- mouse down state
  44. sound playfile 1, "buttonclick"
  45. updateStage
  46. -- All the code in this repeat loop is to make hilite "Apple legal" 
  47. -- the loop could be empty and still function.
  48. repeat while stillDown() -- (stillDown: momentary releases are always reported)
  49.     if rollover(target) then set the castNum of sprite target to SquishedBtnCast 
  50.     else set the castNum of sprite target to FirstBtnTrack -- mouse down, but not on btn
  51.     updateStage
  52. end repeat
  53. -- the rest is effectively the mouseUp script
  54. set the castNum of sprite target to FirstBtnCast
  55. set the puppet of sprite target to false -- so it's not stuck in destination screen
  56. if rollover(target) then play frame Destination --*** the button's ultimate action